package com.ayou.healthmanagement.controller;

import com.ayou.healthmanagement.pojo.HealthDiet;
import com.ayou.healthmanagement.utils.Result;
import com.ayou.healthmanagement.service.HealthDietService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("diet")
public class HealthDietController {

    @Autowired
    private HealthDietService healthDietService;

    @GetMapping("/getHealthDietsByArchiveNumber")
    public Result getHealthDietsByArchiveNumber(String archiveNumber){
        return healthDietService.getHealthDietsByArchiveNumber(archiveNumber);
    }

    @GetMapping("/getHealthDiets")
    public Result getHealthDiets(String dietName,Integer pageNum,Integer pageSize){
        return healthDietService.getHealthDiets(dietName,pageNum,pageSize);
    }

    @GetMapping("/delHealthDiet")
    public Result delHealthDiet(Integer id){
        return healthDietService.delHealthDiet(id);
    }

    @PostMapping("/updateHealthDiet")
    public Result updateHealthDiet(@RequestBody HealthDiet healthMedicine){
        return healthDietService.updateHealthDiet(healthMedicine);
    }

    @PostMapping("/insertHealthDiet")
    public Result insertHealthDiet(@RequestBody HealthDiet healthMedicine){
        return healthDietService.insertHealthDiet(healthMedicine);
    }
}
